--- title: "L1-072 刮刮彩票" created: 2025-11-28 tags: - 算法 --- # L1-072 刮刮彩票 ## 题目 [L1-072 刮刮彩票](https://pintia.cn/problem-sets/994805046380707840/exam/problems/type/7?problemSetProblemId=1336215880692482055&page=0) ![[image-a0570a26.png]] ## 思路分析 懒得想 打表 其实可以用类似n皇后的方法 正对角线x+y 反对角线 n-x+y ## 代码实现 ```cpp #include using namespace std; #define endl '\n' using ll = long long; using ull = unsigned long long; using PII = pair; using Pll = pair; int dx[4]= {-1,0,1,0},dy[4]= {0,1,0,-1}; const int inf = 0x3f3f3f3f; const int N=5; int g[N][N]; multiset used= {1,2,3,4,5,6,7,8,9}; int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); for(int i=1; i<=3; i++) { for(int j=1; j<=3; j++) { cin>>g[i][j]; if(g[i][j]!=0) used.erase(g[i][j]); } } int shengyu; for(auto v:used) shengyu=v; for(int i=1; i<=3; i++) { for(int j=1; j<=3; j++) { if(g[i][j]==0) g[i][j]=shengyu; } } for(int i=0; i<3; i++) { int h,l; cin>>h>>l; cout<>x; if(x==1) { cout<